3 const password
= 'vagrant',
4 path
= require( 'path' ),
7 function relPath( foo
) {
8 return path
.resolve( __dirname
, '../..', foo
);
15 // Define any custom variables.
18 // Use if from tests with:
19 // browser.options.username
20 username
: process
.env
.MEDIAWIKI_USER
=== undefined ?
22 process
.env
.MEDIAWIKI_USER
,
23 password
: process
.env
.MEDIAWIKI_PASSWORD
=== undefined ?
25 process
.env
.MEDIAWIKI_PASSWORD
,
31 services
: [ 'sauce' ],
32 user
: process
.env
.SAUCE_USERNAME
,
33 key
: process
.env
.SAUCE_ACCESS_KEY
,
38 // Define which test specs should run. The pattern is relative to the directory
39 // from which `wdio` was called. Notice that, if you are calling `wdio` from an
40 // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
41 // directory is where your package.json resides, so `wdio` will be called from there.
44 relPath( './tests/selenium/specs/**/*.js' ),
45 relPath( './extensions/*/tests/selenium/specs/**/*.js' ),
46 relPath( './extensions/VisualEditor/modules/ve-mw/tests/selenium/specs/**/*.js' ),
47 relPath( './skins/*/tests/selenium/specs/**/*.js' )
49 // Patterns to exclude.
51 // 'path/to/excluded/files'
57 // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
58 // time. Depending on the number of capabilities, WebdriverIO launches several test
59 // sessions. Within your capabilities you can overwrite the spec and exclude options in
60 // order to group specific specs to a specific capability.
62 // First, you can define how many instances should be started at the same time. Let's
63 // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
64 // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
65 // files and you set maxInstances to 10, all spec files will get tested at the same time
66 // and 30 processes will get spawned. The property handles how many capabilities
67 // from the same test should run tests.
71 // If you have trouble getting all important capabilities together, check out the
72 // Sauce Labs platform configurator - a great tool to configure your capabilities:
73 // https://docs.saucelabs.com/reference/platforms-configurator
75 // For Chrome/Chromium https://sites.google.com/a/chromium.org/chromedriver/capabilities
77 // maxInstances can get overwritten per capability. So if you have an in-house Selenium
78 // grid with only 5 firefox instances available you can make sure that not more than
79 // 5 instances get started at a time.
82 browserName
: 'chrome',
84 // Run headless when there is no DISPLAY
85 // --headless: since Chrome 59 https://chromium.googlesource.com/chromium/src/+/59.0.3030.0/headless/README.md
86 args
: process
.env
.DISPLAY
? [] : [ '--headless' ]
90 // ===================
91 // Test Configurations
92 // ===================
93 // Define all options that are relevant for the WebdriverIO instance here
95 // By default WebdriverIO commands are executed in a synchronous way using
96 // the wdio-sync package. If you still want to run your tests in an async way
97 // e.g. using promises you can set the sync option to false.
100 // Level of logging verbosity: silent | verbose | command | data | result | error
103 // Enables colors for log output.
106 // Warns when a deprecated command is used
107 deprecationWarnings
: true,
109 // If you only want to run your tests until a specific amount of tests have failed use
110 // bail (default is 0 - don't bail, run all tests).
113 // Saves a screenshot to a given path if a command fails.
114 screenshotPath
: './log/',
116 // Set a base URL in order to shorten url command calls. If your `url` parameter starts
117 // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
118 // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
119 // gets prepended directly.
121 process
.env
.MW_SERVER
=== undefined ?
122 'http://127.0.0.1:8080' :
123 process
.env
.MW_SERVER
125 process
.env
.MW_SCRIPT_PATH
=== undefined ?
127 process
.env
.MW_SCRIPT_PATH
130 // Default timeout for all waitFor* commands.
131 waitforTimeout
: 10000,
133 // Default timeout in milliseconds for request
134 // if Selenium Grid doesn't send response
135 connectionRetryTimeout
: 90000,
137 // Default request retries count
138 connectionRetryCount
: 3,
140 // Initialize the browser instance with a WebdriverIO plugin. The object should have the
141 // plugin name as key and the desired plugin options as properties. Make sure you have
142 // the plugin installed before running any tests. The following plugins are currently
144 // WebdriverCSS: https://github.com/webdriverio/webdrivercss
145 // WebdriverRTC: https://github.com/webdriverio/webdriverrtc
146 // Browserevent: https://github.com/webdriverio/browserevent
149 // screenshotRoot: 'my-shots',
150 // failedComparisonsRoot: 'diffs',
151 // misMatchTolerance: 0.05,
152 // screenWidth: [320,480,640,1024]
158 // Test runner services
159 // Services take over a specific job you don't want to take care of. They enhance
160 // your test setup with almost no effort. Unlike plugins, they don't add new
161 // commands. Instead, they hook themselves up into the test process.
163 // Framework you want to run your specs with.
164 // The following are supported: Mocha, Jasmine, and Cucumber
165 // see also: http://webdriver.io/guide/testrunner/frameworks.html
167 // Make sure you have the wdio adapter package for the specific framework installed
168 // before running any tests.
171 // Test reporter for stdout.
172 // The only one supported by default is 'dot'
173 // see also: http://webdriver.io/guide/testrunner/reporters.html
174 reporters
: [ 'spec' ],
176 // Options to be passed to Mocha.
177 // See the full list at http://mochajs.org/
186 // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
187 // it and to build services around it. You can either apply a single function or an array of
188 // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
189 // resolved to continue.
191 * Gets executed once before all workers get launched.
192 * @param {Object} config wdio configuration object
193 * @param {Array.<Object>} capabilities list of capabilities details
195 // onPrepare: function (config, capabilities) {
198 * Gets executed just before initialising the webdriver session and test framework. It allows you
199 * to manipulate configurations depending on the capability or spec.
200 * @param {Object} config wdio configuration object
201 * @param {Array.<Object>} capabilities list of capabilities details
202 * @param {Array.<String>} specs List of spec file paths that are to be run
204 // beforeSession: function (config, capabilities, specs) {
207 * Gets executed before test execution begins. At this point you can access to all global
208 * variables like `browser`. It is the perfect place to define custom commands.
209 * @param {Array.<Object>} capabilities list of capabilities details
210 * @param {Array.<String>} specs List of spec file paths that are to be run
212 // before: function (capabilities, specs) {
215 * Runs before a WebdriverIO command gets executed.
216 * @param {String} commandName hook command name
217 * @param {Array} args arguments that command would receive
219 // beforeCommand: function (commandName, args) {
222 * Hook that gets executed before the suite starts
223 * @param {Object} suite suite details
225 // beforeSuite: function (suite) {
228 * Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
229 * @param {Object} test test details
231 // beforeTest: function (test) {
234 * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
235 * beforeEach in Mocha)
237 // beforeHook: function () {
240 * Hook that gets executed _after_ a hook within the suite ends (e.g. runs after calling
241 * afterEach in Mocha)
243 // afterHook: function () {
246 * Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) ends.
247 * @param {Object} test test details
249 // from https://github.com/webdriverio/webdriverio/issues/269#issuecomment-306342170
250 afterTest: function ( test
) {
251 var filename
, filePath
;
252 // if test passed, ignore, else take and save screenshot
256 // get current test title and clean it, to use it as file name
257 filename
= encodeURIComponent( test
.title
.replace( /\s+/g, '-' ) );
259 filePath
= this.screenshotPath
+ filename
+ '.png';
261 browser
.saveScreenshot( filePath
);
262 console
.log( '\n\tScreenshot location:', filePath
, '\n' );
266 * Hook that gets executed after the suite has ended
267 * @param {Object} suite suite details
269 // afterSuite: function (suite) {
272 * Runs after a WebdriverIO command gets executed
273 * @param {String} commandName hook command name
274 * @param {Array} args arguments that command would receive
275 * @param {Number} result 0 - command success, 1 - command error
276 * @param {Object} error error object if any
278 // afterCommand: function (commandName, args, result, error) {
281 * Gets executed after all tests are done. You still have access to all global variables from
283 * @param {Number} result 0 - test pass, 1 - test fail
284 * @param {Array.<Object>} capabilities list of capabilities details
285 * @param {Array.<String>} specs List of spec file paths that ran
287 // after: function (result, capabilities, specs) {
290 * Gets executed right after terminating the webdriver session.
291 * @param {Object} config wdio configuration object
292 * @param {Array.<Object>} capabilities list of capabilities details
293 * @param {Array.<String>} specs List of spec file paths that ran
295 // afterSession: function (config, capabilities, specs) {
298 * Gets executed after all workers got shut down and the process is about to exit.
299 * @param {Object} exitCode 0 - success, 1 - fail
300 * @param {Object} config wdio configuration object
301 * @param {Array.<Object>} capabilities list of capabilities details
303 // onComplete: function(exitCode, config, capabilities) {